#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#define MY_OFFSET(type,name) (size_t)&(((type*)0)->name)
#define CHANGE(num) (((num&(0xAAAAAAAA))>>1)+((num&(0x55555555))<<1))
int main()
{
	while (1)
	{
		int a;
		scanf("%d", &a);
		printf("%d\n", CHANGE(a));
	}
	return 0;
}
//struct S
//{
//	int a;
//	char b;
//	int c;
//};
//int main()
//{
//	printf("%d\n", MY_OFFSET(struct S, a));
//	printf("%d\n", MY_OFFSET(struct S, b));
//	printf("%d\n", MY_OFFSET(struct S, c));
//	return 0;
//}
